// 用户登录
import IUsers from '../interface/IUsers'
import axios from 'axios'
import http from '../http'
export async function Login(user: IUsers) {
  const req = await axios.request({
    url: '/api/login',
    method: 'post',
    data: { username: user.username, password: user.password },
  })
  return req.data
}

/**
 * 从服务器获取所有用户列表
 *
 * @param params 查询参数，默认为空对象
 * @returns 返回用户列表数组
 */
export async function getAll(params: any = {}) {
  const { rows } = await http({
    method: 'GET',
    path: '/dev-api/system/user/list',
    params,
  })
  return rows
}


/**
 * 获取所有审批用户的列表
 *
 * @returns 返回审批用户列表
 */
export async function getApprovalAll(roleId: number = 102) {
  const { rows } = await http({
    method: 'GET',
    path: '/dev-api/system/role/authUser/allocatedList',
    params: {
      roleId, // 审批角色ID
      pageSize: 999
    },
  })
  return rows
}
